<template>
	<page-body>
		<view class="page">
			<view class="flex align-stretch benben-position-layout flex Withdrawals_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex align-center justify-between flex-sub Withdrawals_fd0_0'>
					<view class='flex align-center Withdrawals_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
						data-url="1">
						<text class='fu-iconfont2  Withdrawals_fd0_0_c0_c0'>&#xE794;</text>
					</view>
					<view class='flex align-center'>
						<text class='Withdrawals_fd0_0_c1_c0'>提现</text>
					</view>
					<view class='flex align-center justify-end Withdrawals_fd0_0_c0' >
						<!-- <text class='Withdrawals_fd0_0_c2_c0'>明细</text> -->
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>

			<view class="flex flex-direction align-stretch benben-flex-layout Withdrawals_flex_1">
				<view class='flex flex-direction align-stretch Withdrawals_fd1_0'>
					<view class="flex">
						<text class='Withdrawals_fd1_0_c0'>输入提现金额</text>
						<text class='Withdrawals_fd0_0_c2_c0' @tap.stop="handleJumpDiy"
						data-type="navigateTo" :data-url="`/pages/qbgl/withdrawalDetails/withdrawalDetails`">明细</text>
					</view>
					
					<view class='flex flex-wrap align-center justify-between Withdrawals_fd1_0_c1'>
						<view class='flex flex-wrap align-center flex-sub Withdrawals_fd1_0_c1_c0'>
							<text class='Withdrawals_fd1_0_c1_c0_c0'>￥</text>
							<benben-input class='flex-sub Withdrawals_fd1_0_c1_c0_c1' type="digit"
								:placeholder="`账户余额${dataMoney}`" confirm-type="done" :maxlength="9"
								placeholder-style="color:#999;font-size:32rpx" v-model="cash_fee" @input="handleInputFunc" />
						</view>
						<text class='Withdrawals_fd1_0_c1_c1' @tap.stop="allmoneyFunc()">全部</text>
					</view>
					<view class='flex flex-wrap align-center Withdrawals_fd1_0_c2'>
						<text class='Withdrawals_fd1_0_c2_c0'>{{rules}}</text>
						<text class='fu-iconfont2  Withdrawals_fd1_0_c2_c1'
							@tap.stop="popupShow1673862116532=true">&#xE600;</text>
					</view>
				</view>
				<view class='flex flex-direction align-stretch Withdrawals_fd1_1'>
					<text class='Withdrawals_fd1_1_c0'>请选择提现方式</text>
					<template v-for='(item,key0) in dataType'>
						<view class='flex flex-wrap align-center Withdrawals_fd1_1_c1'
							@tap.stop="getselectmessageFunc(item)" :key='key0'>
							<image class='Withdrawals_fd1_1_c1_c0' mode="aspectFill" :src='item.thumb'></image>
							<text class='Withdrawals_fd1_1_c1_c1'>{{item.method_name}}</text>
							<image class='Withdrawals_fd1_1_c1_c2' mode="aspectFit" :src='STATIC_URL+"152.png"'
								v-if=" item.method_code==embody_id"></image>
							<image class='Withdrawals_fd1_1_c1_c2' mode="aspectFit" :src='STATIC_URL+"153.png"'
								v-if=" item.method_code!=embody_id"></image>
						</view>
					</template>

				</view>
				<view class='flex flex-wrap align-center justify-center Withdrawals_fd1_2'>
					<button class='Withdrawals_fd1_2_c0' @tap.stop="queryMessageFunc()">提交</button>
				</view>
			</view>


			<benben-popup v-model="popupShow1673862116532" :mask="true" :mask-close-able="true" mode='center'>
				<!---富文本弹窗flex布局开始-->
				<view class="flex flex-direction flex-wrap align-center benben-flex-layout">
					<view class='flex flex-direction flex-wrap align-center Withdrawals_fd2_0'>
						<text class='Withdrawals_fd2_0_c0'>{{dataEssay.name}}</text>

						<scroll-view class='Withdrawals_fd2_0_c1' :scroll-y='true'>
							<view class='flex benben-scroll flex align-center'>
								<jyf-parser class='Withdrawals_fd2_0_c1_c0' :html="dataEssay.content | richTextFormat">
								</jyf-parser>
							</view>
						</scroll-view>

					</view>
					<image class='Withdrawals_fd2_1' mode="aspectFit" :src='STATIC_URL+"154.png"'
						@tap.stop="popupShow1673862116532=false"></image>
				</view>

				<!---富文本弹窗flex布局结束-->

			</benben-popup>
			<benben-popup v-model="popupShow1686628262181" :mask="true" :mask-close-able="true" mode='center'>
				<!---未绑定微信弹窗flex布局开始-->
				<view class="flex flex-direction flex-wrap align-center Withdrawals_flex_3">
					<text class='Withdrawals_fd3_0'>还未绑定微信,是否前往绑定?</text>
					<view class='flex align-center'>
						<button class='Withdrawals_fd3_1_c0' @tap.stop="popupShow1686628262181=false">取消</button>
						<button class='Withdrawals_fd3_1_c1' @tap.stop="gowxFunc()">确定</button>
					</view>
				</view>

				<!---未绑定微信弹窗flex布局结束-->

			</benben-popup>
			<benben-popup v-model="popupShow1686628821361" :mask="true" :mask-close-able="true" mode='center'>
				<!---未绑定支付宝弹窗flex布局开始-->
				<view class="flex flex-direction flex-wrap align-center Withdrawals_flex_4">
					<text class='Withdrawals_fd4_0'>还未绑定支付宝,是否前往绑定?</text>
					<view class='flex align-center'>
						<button class='Withdrawals_fd4_1_c0' @tap.stop="popupShow1686628821361=false">取消</button>
						<button class='Withdrawals_fd4_1_c1' @tap.stop="goalipayFunc()">确定</button>
					</view>
				</view>

				<!---未绑定支付宝弹窗flex布局结束-->

			</benben-popup>
			<benben-popup v-model="popupShow1686629150177" :mask="true" :mask-close-able="true" mode='center'>
				<!---未绑定银行卡弹窗flex布局开始-->
				<view class="flex flex-direction flex-wrap align-center Withdrawals_flex_5">
					<text class='Withdrawals_fd5_0'>还未绑定银行卡,是否前往绑定?</text>
					<view class='flex flex-wrap align-center'>
						<button class='Withdrawals_fd5_1_c0' @tap.stop="popupShow1686629150177=false">取消</button>
						<button class='Withdrawals_fd5_1_c1' @tap.stop="gobankFunc()">确定</button>
					</view>
				</view>

				<!---未绑定银行卡弹窗flex布局结束-->

			</benben-popup>


		</view>
	</page-body>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},


		data() {
			return {
				"popupShow1686629150177": false,
				"popupShow1686628821361": false,
				"popupShow1686628262181": false,
				"popupShow1673862116532": false,
				"embody_id": "wx",
				"dataEssay": {
					"aid": "",
					"name": "",
					"thumb_img": "",
					"content": "",
					"introduce": ""
				},
				"cash_fee": "",
				"dataMessage": [],
				"dataType": [],
				"dataMoney": '',
				"is_bind": "",
				"method_fee": "",
				"method_max": "",
				"method_min": "",
				"rules": "",
				"method_name": "微信"
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {
			this.getWenzhangFunc()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {
			this.searchAccountFunc()
		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//限制两位小数
			handleInputFunc(e) {
				console.log(e,1111)
				let price = e.match(/^\d*(\.?\d{0,2})/g)[0];
				let that = this;
				if (this.cash_fee != price) {
					this.$nextTick(() => {
						this.cash_fee = price
					})
					return
				}
			},
			//点击全部
			allmoneyFunc() {
				this.cash_fee = this.dataMoney;
			},
			//获取支付方式
			async searchAccountFunc() {
				//请求方法
				//数据验证

				let datadataType = await this.$api.get(global.apiUrls.post62fc4f70a9d44, {
					scene: 'money'
				});

				if (datadataType.data.code != 1) {
					this.$message.info(datadataType.data.msg);
					return
				}
				let infodataType = datadataType.data;
				this.dataType = infodataType.data

				if (this.dataType) {
					this.is_bind = this.dataType[0].is_bind;
					this.method_fee = this.dataType[0].method_fee;
					this.method_max = this.dataType[0].method_max;
					this.method_min = this.dataType[0].method_min;
					this.rules = this.dataType[0].rules;
					this.embody_id = this.dataType[0].method_code;
					this.method_name = this.dataType[0].method_name;
				}
				this.getMoneyFunc()
			},
			//获取选择类型信息
			getselectmessageFunc(item) {
				this.is_bind = item.is_bind;
				this.method_fee = item.method_fee;
				this.method_max = item.method_max;
				this.method_min = item.method_min;
				this.rules = item.rules;
				this.embody_id = item.method_code;
				this.method_name = item.method_name;
				if (this.is_bind == 0) {
					if (this.embody_id == 'wx') {
						this.$message.info('还未绑定微信，请先绑定微信');
					}
					if (this.embody_id == 'alipay') {
						this.$message.info('还未绑定支付宝，请先绑定支付宝');
					}
					if (this.embody_id == 'bank') {
						this.$message.info('还未绑定银行卡，请先绑定银行卡');
					}
				}
			},
			//提现
			queryMessageFunc() {
				
				if (!validate(this.cash_fee, 'require')) {
					this.$message.info('请输入提现金额');
					return false;
				}
				
				if (this.cash_fee > this.dataMoney) {
					this.cash_fee = '';
					this.$message.info('余额不足，请重新输入金额');
					return
				}
				console.log(this.embody_id,1111111)
				if (this.is_bind == 0) {
					if (this.embody_id == '1') {
						this.popupShow1686628262181 = true;
					} else if (this.embody_id == '2') {
						this.popupShow1686628821361 = true;
					} else if (this.embody_id == '3') {
						this.popupShow1686629150177 = true;
					}
				} else {
					this.postWithdrawalFunc()
				}
			},
			//跳转绑定微信
			gowxFunc() {
				this.popupShow1686628262181 = false;
				this.$urouter.navigateTo(`/pages/qbgl/bindWechat/bindWechat`);
			},
		
			//跳转支付宝
			goalipayFunc() {
				this.popupShow1686628821361 = false;
				this.$urouter.navigateTo(`/pages/qbgl/bindAlipay/bindAlipay`);
			},
			//跳转银行卡
			gobankFunc() {
				this.popupShow1686629150177 = false;
				this.$urouter.navigateTo(`/pages/qbgl/bindBankCard/bindBankCard`);
			},
			//发送提现接口
			async postWithdrawalFunc() {
				//请求方法
				//数据验证

				let datadataMessage = await this.$api.post(global.apiUrls.post636e4ff0626ef, {
					account_type: this.embody_id,
					cash_fee: this.cash_fee
				});

				if (datadataMessage.data.code != 1) {
					this.$message.info(datadataMessage.data.msg);
					return
				}
				let infodataMessage = datadataMessage.data;
				this.dataMessage = infodataMessage.data

				this.$urouter.redirectTo(`/pages/qbgl/application/application?type=${this.method_name}&money=${this.cash_fee}`);
			},
			//获取可提现金额
			async getMoneyFunc() {
				//请求方法
				//数据验证
				
				
				let datadetail = await this.$api.get(global.apiUrls.post6674ed4a676bb, {
				
				});
				
				if (datadetail.data.code != 1) {
				    this.$message.info(datadetail.data.msg);
				    return
				}
				let infodetail = datadetail.data;
				this.dataMoney = infodetail.data.user_money
				// console.log(this.dataMoney,123)

				// let datadataMoney = await this.$api.get(global.apiUrls.post636d04052bb00, {

				// });

				// if (datadataMoney.data.code != 1) {
				// 	this.$message.info(datadataMoney.data.msg);
				// 	return
				// }
				// let infodataMoney = datadataMoney.data;
				// this.dataMoney = infodataMoney.data

			},
			//系统文章--获取系统单页内容
			async getWenzhangFunc() {
				//请求方法
				//数据验证

				let datadataEssay = await this.$api.get(global.apiUrls.post646576063f6b7, {
					column_id: '12'
				});

				if (datadataEssay.data.code != 1) {
					this.$message.info(datadataEssay.data.msg);
					return
				}
				let infodataEssay = datadataEssay.data;
				this.dataEssay = infodataEssay.data

			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #F8F8F8;
		background-size: 100% auto;
	}

	.Withdrawals_flex_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.Withdrawals_fd0_0_c2_c0 {
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
		margin: 0 0 0 auto;
	}

	.Withdrawals_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333;
	}

	.Withdrawals_fd0_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
	}

	.Withdrawals_fd0_0_c0 {
		width: 180rpx;
	}

	.Withdrawals_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.Withdrawals_flex_1 {
		padding: 0rpx 0rpx 150rpx 0rpx;
	}

	.Withdrawals_fd1_2_c0 {
		background: var(--benbenbgColor7);
		border-radius: 40rpx 40rpx 40rpx 40rpx;
		font-size: 32rpx;
		color: #fff;
		width: 686rpx;
		height: 80rpx;
		line-height: 80rpx;
		font-weight: 700;
	}

	.Withdrawals_fd1_2 {
		width: 750rpx;
		position: fixed;
		left: 0rpx;
		bottom: calc(40rpx + var(--window-bottom));
	}

	.Withdrawals_fd1_1_c1_c2 {
		width: 36rpx;
		height: 36rpx;
		margin: 0rpx 0rpx 0rpx auto;
		border-radius: 18rpx 18rpx 18rpx 18rpx;
	}

	.Withdrawals_fd1_1_c1_c1 {
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
	}

	.Withdrawals_fd1_1_c1_c0 {
		width: 52rpx;
		height: 52rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.Withdrawals_fd1_1_c1 {
		border-bottom: 1px solid #eee;
		padding: 28rpx 0rpx 28rpx 0rpx;
	}

	.Withdrawals_fd1_1_c0 {
		font-size: 32rpx;
		font-weight: 700;
		color: #333;
		margin: 0rpx 0rpx 8rpx 0rpx;
	}

	.Withdrawals_fd1_1 {
		background: var(--benbenbgColor1);
		padding: 32rpx 32rpx 0rpx 32rpx;
		background-size: 100% auto !important;
		margin: 20rpx 0rpx 0rpx 0rpx;
	}

	.Withdrawals_fd1_0_c2_c1 {
		margin: 0rpx 0rpx 0rpx 16rpx;
		color: rgba(191, 191, 191, 1);
		font-size: 26rpx;
	}

	.Withdrawals_fd1_0_c2_c0 {
		line-height: 53rpx;
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
	}

	.Withdrawals_fd1_0_c2 {
		margin: 24rpx 0rpx 0rpx 0rpx;
	}

	.Withdrawals_fd1_0_c1_c1 {
		font-size: 32rpx;
		font-weight: 500;
		color: var(--benbenFontColor7);
	}

	.Withdrawals_fd1_0_c1_c0_c1 {
		padding: 0rpx 0rpx 0rpx 16rpx;
		font-size: 32rpx;
	}

	.Withdrawals_fd1_0_c1_c0_c0 {
		font-size: 56rpx;
		font-weight: 400;
		color: #333333;
	}

	.Withdrawals_fd1_0_c1_c0 {
		padding: 32rpx 0rpx 32rpx 0rpx;
	}

	.Withdrawals_fd1_0_c1 {
		border-bottom: 1px solid #eee;
	}

	.Withdrawals_fd1_0_c0 {
		font-size: 32rpx;
		font-weight: 700;
		color: #333333;
	}

	.Withdrawals_fd1_0 {
		background: var(--benbenbgColor1);
		padding: 32rpx;
		background-size: 100% auto !important;
	}

	.Withdrawals_fd2_1 {
		width: 56rpx;
		height: 56rpx;
		border-radius: 28rpx 28rpx 28rpx 28rpx;
	}

	::v-deep .Withdrawals_fd2_0_c1_c0 {
		width: 480rpx;
	}

	.Withdrawals_fd2_0_c1 {
		touch-action: none;
		height: 330rpx;
		width: 480rpx;
	}

	.Withdrawals_fd2_0_c0 {
		font-size: 36rpx;
		font-weight: 700;
		color: rgba(51, 51, 51, 1);
		margin: 0rpx 0rpx 32rpx 0rpx;
	}

	.Withdrawals_fd2_0 {
		background: #fff;
		width: 560rpx;
		background-size: 100% auto !important;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		padding: 28rpx 32rpx 45rpx 32rpx;
		margin: 0rpx 0rpx 40rpx 0rpx;
	}

	.Withdrawals_flex_3 {
		background: #fff;
		width: 540rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.Withdrawals_fd3_1_c1 {
		border-top: 1px solid #eee;
		border-left: 1px solid #eee;
		background: var(--benbenbgColor1);
		line-height: 94rpx;
		border-radius: 0rpx 0rpx 16rpx 0rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor5);
		padding: 0rpx 102rpx 0rpx 101rpx;
		font-weight: 500;
	}

	.Withdrawals_fd3_1_c0 {
		border-top: 1px solid #eee;
		background: #fff;
		line-height: 94rpx;
		border-radius: 0rpx 0rpx 0rpx 16rpx;
		font-size: 32rpx;
		color: rgba(153, 153, 153, 1);
		padding: 0rpx 102rpx 0rpx 103rpx;
		font-weight: 400;
	}

	.Withdrawals_fd3_0 {
		line-height: 44rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: #333333;
		margin: 91rpx 0rpx 88rpx 0rpx;
	}

	.Withdrawals_flex_4 {
		background: #fff;
		width: 540rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.Withdrawals_fd4_1_c1 {
		border-top: 1px solid #eee;
		border-left: 1px solid #eee;
		background: #fff;
		line-height: 94rpx;
		border-radius: 0rpx 0rpx 16rpx 0rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor5);
		padding: 0rpx 102rpx 0rpx 101rpx;
		font-weight: 500;
	}

	.Withdrawals_fd4_1_c0 {
		border-top: 1px solid #eee;
		background: #fff;
		line-height: 94rpx;
		border-radius: 0rpx 0rpx 0rpx 16rpx;
		font-size: 32rpx;
		color: rgba(153, 153, 153, 1);
		padding: 0rpx 102rpx 0rpx 103rpx;
		font-weight: 400;
	}

	.Withdrawals_fd4_0 {
		line-height: 44rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: #333333;
		margin: 91rpx 0rpx 88rpx 0rpx;
	}

	.Withdrawals_flex_5 {
		background: #fff;
		width: 540rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.Withdrawals_fd5_1_c1 {
		border-top: 1px solid #eee;
		border-left: 1px solid #eee;
		background: #fff;
		line-height: 94rpx;
		border-radius: 0rpx 0rpx 16rpx 0rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor5);
		padding: 0rpx 102rpx 0rpx 101rpx;
		font-weight: 500;
	}

	.Withdrawals_fd5_1_c0 {
		border-top: 1px solid #eee;
		background: #fff;
		line-height: 94rpx;
		border-radius: 0rpx 0rpx 0rpx 16rpx;
		font-size: 32rpx;
		color: rgba(153, 153, 153, 1);
		padding: 0rpx 102rpx 0rpx 103rpx;
		font-weight: 400;
	}

	.Withdrawals_fd5_0 {
		line-height: 44rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: #333333;
		margin: 91rpx 0rpx 88rpx 0rpx;
	}
</style>
